package org.example;

import org.example.Strategy.NoDiscount;
import org.example.Strategy.OrderFullDiscount;
import org.example.Strategy.PercentageDiscount;
import org.example.cart.ShoppingCart;
import org.example.domain.Product;

import java.math.BigDecimal;

public class Main {
    public static void main(String[] args) {
        // 顾客 A：购买 2 斤苹果，3 斤草莓
        Product apple = new Product("苹果", new BigDecimal("8.00"), new NoDiscount());
        Product strawberry = new Product("草莓", new BigDecimal("13.00"), new NoDiscount());
        ShoppingCart cart = new ShoppingCart();
        cart.addItem(apple,  2);
        cart.addItem(strawberry,  3);
        System.out.println("顾客 A 的购物总价是: " + cart.calculateTotal());
        System.out.println("=====================");

        // 顾客 B：购买 2 斤苹果，3 斤草莓，1 斤芒果
        Product appleB = new Product("苹果", new BigDecimal("8.00"), new NoDiscount());
        Product strawberryB = new Product("草莓", new BigDecimal("13.00"), new NoDiscount());
        Product mangoB = new Product("芒果", new BigDecimal("20.00"), new NoDiscount());
        ShoppingCart cartB = new ShoppingCart();
        cartB.addItem(appleB,  2);
        cartB.addItem(strawberryB,  3);
        cartB.addItem(mangoB,  1);
        System.out.println("顾客 B 的购物总价是: " + cartB.calculateTotal());
        System.out.println("=====================");

        // 顾客 C：购买 2 斤苹果，3 斤草莓，1 斤芒果 ; 打折
        Product appleC = new Product("苹果", new BigDecimal("8.00"), new NoDiscount());
        Product strawberryC = new Product("草莓", new BigDecimal("13.00"), new PercentageDiscount(new BigDecimal(0.8)));
        Product mangoC = new Product("芒果", new BigDecimal("20.00"), new NoDiscount());
        ShoppingCart cartC = new ShoppingCart();
        cartC.addItem(appleC,  2);
        cartC.addItem(strawberryC,  3);
        cartC.addItem(mangoC,  1);
        System.out.println("顾客 C 的购物总价是: " + cartC.calculateTotal());
        System.out.println("=====================");

        // 顾客 D：购买 5 斤苹果，3 斤草莓，2 斤芒果 ; 打折 ; 满减
        Product appleD = new Product("苹果", new BigDecimal("8.00"), new NoDiscount());
        Product strawberryD = new Product("草莓", new BigDecimal("13.00"), new PercentageDiscount(new BigDecimal(0.8)));
        Product mangoD = new Product("芒果", new BigDecimal("20.00"), new NoDiscount());
        ShoppingCart cartD = new ShoppingCart();
        cartD.setOrderDiscount(new OrderFullDiscount(new BigDecimal(100.00),new BigDecimal(10.00)));
        cartD.addItem(appleD,  5);
        cartD.addItem(strawberryD,  3);
        cartD.addItem(mangoD,  2);
        System.out.println("顾客 D 的购物总价是: " + cartD.calculateTotal());
        System.out.println("=====================");

    }
}